package com.flyoil.petromp.adapter.adapter_course;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.flyoil.petromp.R;
import com.flyoil.petromp.base.MyBaseAdapter;
import com.flyoil.petromp.entity.entity_course_list.CourseEntity;

/**
 * Created by songzhiiyn on 2017/10/11.
 * 流程列表第二级列表的适配器
 */

public class ItemCourseChildrenAdapter extends MyBaseAdapter<CourseEntity.Children> {
    public ItemCourseChildrenAdapter(Context context) {
        super(context);
    }

    @Override
    public View setView(int position, View convertView, ViewGroup parent) {
        ViewHoder hoder;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.item_course_list_children_adapter, null);
            hoder = new ViewHoder(convertView);
            convertView.setTag(hoder);
        } else {
            hoder = (ViewHoder) convertView.getTag();
        }
        CourseEntity.Children children = (CourseEntity.Children) getItem(position);
        hoder.tv_name.setText(children.getName());
        return convertView;
    }

    private class ViewHoder {
        private TextView tv_name;

        public ViewHoder(View itemView) {
            this.tv_name = (TextView) itemView.findViewById(R.id.tv_item_course_list_children_name);
        }
    }
}
